package lzyc.pointsManagement.business.points.controller;

import lzyc.pointsManagement.business.points.domain.PointsInfo;
import lzyc.pointsManagement.business.points.service.PointsInfoService;
import lzyc.pointsManagement.common.response.ResponseMessage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (PointsInfo)表控制层
 *
 * @author yangyang
 * @since 2024-03-10 17:11:34
 */
@RestController
@RequestMapping("/api/v1/score")
public class PointsInfoController {
    /**
     * 服务对象
     */
    @Resource
    private PointsInfoService pointsInfoService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @PostMapping("selectOne")
    public PointsInfo selectOne(String id) {
        return this.pointsInfoService.queryById(id);
    }

    @PostMapping("add")
    public ResponseMessage add(String projectId) {
        return this.pointsInfoService.addPointsFromCourse(projectId);
    }

    @PostMapping("/getpersonalmonthpoints")
    public ResponseMessage getPersonalMonthPoints(@RequestParam String userId) {
        return pointsInfoService.getPersonalMonthPoints(userId);
    }

    @PostMapping("/getpersonalpoints")
    public ResponseMessage getPersonalPoints(@RequestParam String userId) {
        return pointsInfoService.getPersonalPoints(userId);
    }
    @PostMapping("/rank")
    public ResponseMessage getPointsRank() {
        return pointsInfoService.getPointsRank();
    }

    @PostMapping("/monthrank")
    public ResponseMessage getMonthPointsRank() {
        return pointsInfoService.getMonthPointsRank();
    }

    @PostMapping("/grouprank")
    public ResponseMessage getGroupPointsRank() {
        return pointsInfoService.getGroupPointsRank();
    }



}